<template>
  <div class="goods-item" @click="goodsItemClick(goods_info.p_feed)">
    <img v-lazy="goods_info.img_url" alt="goodsimg" @load="imgLoad" />

    <div class="goods-name">{{ goods_info.goods_name }}</div>
    <div class="goods-tips">
      <span class="price">￥{{ goods_info.goods_price }}</span>
      <span class="collect">{{ goods_info.p_feed }}☆</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    goods_info: {
      type: Object,
      default() {
        return {}
      },
    },
  },
  methods: {
    imgLoad() {
      this.$bus.$emit('itemImageLoad')
    },
    goodsItemClick(e) {
      this.$router.push(`/detail/${e}`)
    },
  },
}
</script>

<style lang="less" scoped>
.goods-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
  // justify-content: center;
  // align-items: center;

  img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 5px;
  }

  .goods-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    padding: 0 5px;
    margin-bottom: 5px;
  }

  .goods-tips {
    display: flex;
    flex-direction: row;
    padding: 0 5px;
    justify-content: space-between;
    .price {
      color: @base-color;
      font-weight: bold;
    }

    .collect {
      color: orange;
    }
  }
}
</style>
